



<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %>
<%@ taglib prefix="s" uri="/struts-tags" %>

<tiles:insertDefinition name="mainLayout">
  <tiles:putAttribute name="title"  value="Liste des adresses" />
  <tiles:putAttribute name="body">

<script type="text/javascript">
<!--
	function confirmDelete(id)
	{
		return confirm("Voulez-vous vraiment supprimer l'objet ayant pour id: "+id);
	}
//-->
</script>

<s:url id="prepareaddUrl" action="prepareadd" />
<p><s:a href="%{prepareaddUrl}" cssClass="commandLink">Ajouter un objet adresse</s:a></p>

<p class="pageTitle">Liste des adresses</p>

<table width="90%">
  <tr>
	    	<th>Id</th>
    							    	<th>City</th>
    	    	<th>Street1</th>
    	    	<th>Street2</th>
    	    	<th>Zipcode</th>
    							    <th>&nbsp;</th>

  </tr>

<s:iterator value="%{#request.adresses}">
  <tr>
	    <td>
    <s:url id="editUrl" action="edit" >
		<s:param name="id" value="%{id}" />
	</s:url>
    <s:a href="%{editUrl}" cssClass="commandLink"><s:property value="id"/></s:a>
    </td>
    							    <td><s:property value="city"/></td>
    	    <td><s:property value="street1"/></td>
    	    <td><s:property value="street2"/></td>
    	    <td><s:property value="zipcode"/></td>
    								    <td>
    <s:url id="deleteUrl" action="delete" >
		<s:param name="id" value="%{id}" />
	</s:url>
    <s:a href="%{deleteUrl}" cssClass="commandLink" onclick="return confirmDelete(%{id});">Supprimer</s:a>
    </td>
						  </tr>
</s:iterator>

</table>

<p class="spacer">&nbsp;</p>

<fieldset title="Recherche">
<legend><b>Recherche d'un objet adresse</b></legend>
<s:form action="search" method="post" validate="false">
			  		<s:textfield label="city" name="adresse.city" size="30" />
  		  				  		<s:textfield label="street1" name="adresse.street1" size="30" />
  		  				  		<s:textfield label="street2" name="adresse.street2" size="30" />
  		  				  		<s:textfield label="zipcode" name="adresse.zipcode" size="30" />
  		  		  	  	  	  	  	  <s:submit value="Rechercher"/>
</s:form>
</fieldset>

  </tiles:putAttribute>
</tiles:insertDefinition>
